
<%@page import="org.jackysoft.util.*"%>
<%@ page contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib  uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib  uri="http://www.springframework.org/security/tags" prefix="sec" %>
<%@ taglib  uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib  uri="http://www.joda.org/joda/time/tags" prefix="joda" %>
<style>
.detail-panel {
	display:none;
}
</style>
<c:set var="ptn" value="######0.0000" />
<table class="table table-hover table-bordered table-striped table-condensed ">
<thead>
  <tr>
    <th>
    <button class="btn btn-info"
      onclick="doPost('contract/contract!startquery')"
    >继续查询</button>
    </th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
  </tr>
  <tr>
    <th>产品代码</th>
    <th>名称</th>
     
    <th>生产单位</th>
    
    <th>明细</th>
  </tr>
</thead>
<tbody>
  <c:forEach items="${pager.rows}" var="item">
   
   <tr class="success">
    <td>     
     <span class="label label-info">
       ${item.code}
     </span>    
    </td>
    <td>
    <span class="label label-inverse">
       ${item.pdtName}
       </span>
    </td>
    <td>
     ${item.deptName}
    </td>   
    <td class="btn-group">       
        <button class="btn btn-inverse"
        type="button"
        onclick="loadDetails('${item.id}_panel','${item.id}_details','${item.code}')"
       >
                                   明细
       </button> 
    </td>
   </tr>  
   <%
      Months[] ms = Months.values();
      pageContext.setAttribute("months", ms);
      //Weeks[] ws = Weeks.values();
   %>
  
   <tr class="info">
    
    <td colspan="10" id="${item.id}_panel" class="detail-panel"> 
     <table class="table table-condensed">
     <caption class="label label-warning">总量[${item.amount}]</caption>
         <thead>
         <tr> 
          <c:forEach items="${months}" var="m">
            <th>
            <span class="${item[m.name]==0?'':'label label-important'}">
            ${m.label}月
            </span>
            </th>         
          </c:forEach>         
         </tr>  
         </thead>
         <tbody>
           <tr>
              <c:forEach items="${months}" var="m">
            <td>
             <span >
                ${item[m.name]}
             </span>             
            </td>         
          </c:forEach> 
           </tr>
           <tr>
             <th colspan="3">            
             <span class="${item.q1>0?'label label-important':''}">一季度</span>                    
                                         
            </th>
             <th colspan="3">            
             <span class="${item.q2>0?'label label-important':''}">二季度</span>                    
                                         
            </th>
             <th colspan="3">            
             <span class="${item.q3>0?'label label-important':''}">三季度</span>                    
                                         
            </th>
             <th colspan="3">            
             <span class="${item.q4>0?'label label-important':''}">四季度</span>                    
                                         
            </th>             
           </tr>
           <tr>
             <th colspan="3">
             <span class="${item.q1>0?'label label-important':''}">
             <fmt:formatNumber value="${item.q1}" pattern="${ptn}" />
             </span> 
             </th>
             <th colspan="3">
             <span class="${item.q2>0?'label label-important':''}">
              <fmt:formatNumber value="${item.q2}" pattern="${ptn}" />
             </span> 
             </th>
             <th colspan="3">
             <span class="${item.q3>0?'label label-important':''}">
               <fmt:formatNumber value="${item.q3}" pattern="${ptn}" />
              
             </span> 
             </th>
             <th colspan="3">
             <span class="${item.q4>0?'label label-important':''}">
              <fmt:formatNumber value="${item.q4}" pattern="${ptn}" />
             
             </span> 
             </th>             
           </tr>
         </tbody>     
     </table>
       <div id="${item.id}_details">
     
     </div>
    </td>
    
   </tr>
  </c:forEach>
</tbody>
<tfoot>
 <th colspan="9">
  ${pager.pagination}
 </th>
</tfoot>
</table>
<form id="detailsform">
   <input id="sqlid2" type="hidden" name="query.sqlId" value="statAllByDate" />
   <input name="query.fields[0].name"   type="hidden" value="a.code" />
   <input name="query.fields[0].inOpr"  type="hidden" value="等于" />
   <input name="query.fields[0].value"  type="hidden" id="dcode" />
</form>
<script type="text/javascript" src="scripts/apps/contract/query.js"></script>